<nz-modal [(nzVisible)]="isVisible"  nzTitle="修改密码" (nzOnCancel)="handleCancel()"
          (nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">

  <form nz-form [formGroup]="formModel">

    <nz-form-item>
      <nz-form-label [nzSpan]="6" nzRequired>原密码</nz-form-label>
      <nz-form-control [nzSpan]="15" nzHasFeedback nzValidatingTip="验证中..."  [nzErrorTip]="passwordErrorTpl!">
        <input nz-input type="password" minlength="6" formControlName="password" placeholder="请输入登录密码!"
               (ngModelChange)="validateConfirmPassword()" readonly onfocus="this.removeAttribute('readonly');"/>
        <ng-template #passwordErrorTpl let-control>
          <ng-container *ngIf="control.hasError('minlength')">密码最小为6位数</ng-container>
          <ng-container *ngIf="control.hasError('required')">请输入登录密码</ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>


    <nz-form-item>
      <nz-form-label [nzSpan]="6" nzRequired>新密码</nz-form-label>
      <nz-form-control [nzSpan]="15" nzHasFeedback [nzErrorTip]="passwordErrorTpl!">
        <input nz-input type="password" minlength="6" formControlName="newPassword" placeholder="请输入新密码!"
               (ngModelChange)="validateConfirmPassword()" readonly onfocus="this.removeAttribute('readonly');"/>

        <ng-template #passwordErrorTpl let-control>
          <ng-container *ngIf="control.hasError('minlength')">密码最小为6位数</ng-container>
          <ng-container *ngIf="control.hasError('required')">请输入登录密码</ng-container>
        </ng-template>

      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSpan]="6" nzRequired>确认密码</nz-form-label>
      <nz-form-control [nzSpan]="15" nzHasFeedback [nzErrorTip]="confirmPasswordErrorTpl">
        <input nz-input type="password" minlength="6" formControlName="confirm" placeholder="请输入确认密码!"
               readonly onfocus="this.removeAttribute('readonly');"/>
        <ng-template #confirmPasswordErrorTpl let-control>
          <ng-container *ngIf="control.hasError('required')">请输入确认密码!</ng-container>
          <ng-container *ngIf="control.hasError('confirm')">您输入的两个密码不一致!</ng-container>
          <ng-container *ngIf="control.hasError('minlength')">密码最小为6位数</ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
  </form>

</nz-modal>
